package lab01;

import java.util.Scanner;

public class text12 {
    public static void main(String[] args) {
        int a,b,c,d,num=0;

        System.out.println("请输入一个数：");
        Scanner input=new Scanner(System.in);
        num=input.nextInt();

        if(num>=1&&num<10000){
            a=num/1000;
            b=(num%1000)/100;
            c=(num%100)/10;
            d=num%10;

            if(a!=0){
                System.out.println(num+"是4位数");
                if(a==d&&b==c){
                    System.out.println(num+"是回文数");
                }
                else{
                    System.out.println(num+"不是回文数");
                }
            }
            else if(b!=0){
                System.out.println(num+"是3位数");
                if(b==d){
                    System.out.println(num+"是回文数");
                }
                else{
                    System.out.println(num+"不是回文数");
                }
            }
            else if(c!=0){
                System.out.println(num+"是2位数");
                if(c==d){
                    System.out.println(num+"是回文数");
                }
                else{
                    System.out.println(num+"不是回文数");
                }
            }
            else{
                System.out.println(num+"是1位数");
                System.out.println(num+"是回文数");
            }
        }
        else{
            System.out.println("该数不在1-9999之间，请重新输入！");
        }
    }
}
